<?php
include('header.php');
if(!$is_online){
	redirect('index.php');
	exit;
}

$id = $db->EscapeString($_GET['id']);

$x = $db->FetchArray($db->Query("SELECT id,site FROM `surf` WHERE `id`='{$id}' AND `confirm`>'0'"));
if($x['id'] == ''){
	redirect('index.php');
	exit;
}
?>
<div class="block medium right">
			<div class="top"><h1>Confirm Website</h1></div>
			<div class="content">		
<script>
var counterName='countDown';
function start(){ displayCountdown(15-1);}
loaded(start);
var pageLoaded=0;
window.onload=function(){pageLoaded=1;}
function loaded(functionName){ if(document.getElementById && document.getElementById(counterName) != null){ functionName(); }else{if(!pageLoaded){ setTimeout('loaded('+functionName+')',100); }}}
function displayCountdown(counter){
if(counter <= 0){
    $("#countOutcome").html('<font size=2><b>Loading...</b></font>');
	$.ajax({
		type: "POST",
		url: "pages/c_surf.php",
		data: "data=<?=$x['id']?>", 
		success: function(msg){
			$("#countOutcome").html(msg);
		}
	});
}else{
document.getElementById(counterName).innerHTML=counter;
setTimeout('displayCountdown('+(counter-1)+');',1000);
}
}
</script>
<table cellpadding="2" cellspacing="0" width="98%" align="center" class="maintable"><tr><td><center><b>Wait for the timer and then your website will be confirmed automaticaly.</b><br><br><span id="countOutcome"><font size="3"><b>Please wait for <span id="countDown">0</span> seconds.</b></font><br>[<a href="mysites.php"><font color="red">Cancel</font></a>]</span><br><iframe src="<?=$x['site']?>" width="540" height="250"></iframe></center></td></tr></table></td></tr></table>	
		</div>
	</div>
<?include('footer.php');?>